var ws, uid, ilist;
document.addEventListener('plusready',function(){
	uid = plus.storage.getItem('uid');
	ws = plus.webview.currentWebview();
	var info = plus.storage.getItem('family');
	ilist = $.parseJSON(info);
	$('.search').on('input paste', function() {
		var search = $('.search').val();
		console.log(search);
		familyList(search);
	})
})
function familyList(str){
	var list = ''; 
	$.each(ilist, function(k,v) {
		if(v.name.indexOf(str) >= 0){
			list += '<div class="mui-table-view mui-table-view-cell bbs-ico lifamily'+v.aid+'">'+
					'<div class="overflow-h mui-slider-handle goinfo" fid="'+v.aid+'">'+
						'<i><img src="'+getAvatar(v.photo)+'"/></i>'+
						'<div>'+
							'<li>'+
								'<span>'+v.name+'</span>'+
								'<span class="mui-h6 mui-pull-right">'+((v.sex == 0)?'男':'女')+'</span>'+
							'</li>'+
							'<li class="mui-h6 ">'+
								'<span>手机:'+v.phone+'</span>'+
								'<span class="mui-pull-right">'+v.age+'岁</span>'+
							'</li>'+
						'</div>'+
					'</div>'+
					'<div class="mui-slider-right mui-disabled" onclick="delfamily(' + v.aid + ')">'+
						'<a class="mui-btn mui-btn-red">删除</a>'+
					'</div>'+
				'</div>';
		}
	})
	$('.familylist').html(list);
	$('.goinfo').click(function(){
		goNewPage('me-family-bianji.html',{aid:$(this).attr('fid'),page:ws.id})
	})
}
